home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-05-23 | 2.6 KB | 66 lines | [TEXT/McSk] |
- ( Misc extras for Pocket Forth 0.6 ) decimal
-
- : 00>R ( rstack: -- 0 0 ) ,$ 42A7 ; macro ( clr.l -[rs] )
- : 2R ( -- d ) ( rstack: d -- d )
- ,$ 2D17 ; macro ( move.l [rs],-[ps] )
-
- : SP! ( -- ) s0@ ,$ 2C5E ; ( move.l [ps]+,ps ) ( reset pstack )
- : RP! ( -- ) r0@ ,$ 2E5E ; ( move.l [ps]+,rs ) ( reset rstack )
-
- : NIP ( n1 n2 -- n2 ) ,$ 3C9E ; macro ( move [ps]+,[ps] )
- : TUCK ( n1 n2 -- n2 n1 n2 ) swap over ;
-
- : 2- ( n -- n-2 ) ,$ 5556 ; macro ( subq #2,[ps] )
- : 4+ ( n -- n+4 ) ,$ 5856 ; macro ( addq #4,[ps] )
-
- : RANDOM ( n -- n' ) ( random number from 0 to n )
- 0 >r ,$ A861 r> ( _Random )
- swap 32768 */ abs ; ( scale to size from stack )
-
- : ?COLOR ( -- f ) ( true if color is available [system6+] )
- ,$ 204A ( movea.l a2,a0 )
- ,$ 7001 ( moveq.l #$01,d0 )
- ,$ A090 ( _SysEnvirons )
- here 9 + c@ ; ( color qd available? )
-
- : SSIZE ( -- h v ) ( screen size in pixels )
- ,$ 2d2d ,$ ff8c ; macro ( move.l screenBits[a5],-[ps] )
-
- : .ALERT ( resource.ID -- dismissing.item.number )
- ,$ 4267 >r ,$ 42a7 ( clr -[a7] move [a6]+,-[a7] clr.l -[a7] )
- ,$ a985 r> ; ( _Alert move [a7]+,-[a7] )
-
- : >CLIP ( c -- ) ( put a character on the clipboard )
- 256 * ( move ascii data into byte position )
- 00>r ,$ A9FC 2r> 2drop ( _ZeroScrap )
- 00>r 1 0 2>r ,s TEXT 2>r sp@ 2>r ,$ A9FE ( _PutScrap )
- 2r> + IF beep THEN ; ( beep on error )
-
- : GROW ( -- ) ( increase free space ) ( WARNING: default at maximum )
- [ ' save 42 + literal ] execute ; ( no longer in dictionary )
-
- : EVEN ( n -- n' ) dup 2 mod + ; ( round up to even number )
- : ," ( -- ) ( compile a quoted string from input stream )
- 34 word here c@ 1+ even allot ; IMMEDIATE
-
- ( Display relative addresses in hex )
- : SPACES ( n -- ) 0 DO space LOOP ; ( emit n spaces )
- : H.2 ( n -- ) ( print a hex number )
- base @ >r hex dup 16 < IF
- 0 . 8 emit THEN . r> base ! ;
- : A. ( addr -- ) h.2 8 emit ." :" 2 spaces ; ( print addr )
- : DUMP ( addr len -- ) ( do a formatted hex dump of memory )
- swap dup -16 and swap dup a. over - ( round start addr )
- dup 0 DO 3 spaces LOOP ." |" rot + ( indicate start addr )
- over cr a. 0 DO ( do for each len+[rounded.addr - real.addr])
- dup r + c@ h.2 ( print byte value at addr + index )
- r 1+ 16 mod 0= IF ( break at end of 16 byte line )
- ( 2 spaces dup r + 15 - 16 type ( type the line ) ( long )
- dup r + 1+ cr a. THEN LOOP ( start a new line )
- drop cr ;
-
- room page
- ( You have just loaded several utility words.)
- ( Examine them in the Misc file for more info).
- ( bytes of dictionary left. )
-